<?php 

header('Content-Type: text/xml');

// inputs
$title = (string)$_GET['title'];
$walkDesc = (string)$_GET['walkDesc'];
$pntCnt = (float)$_GET['pntCnt'];
$uid = (string)$_GET['uid'];
$center  = (string)$_GET['center'];
$pnts = (string)$_GET['pnts'];
$desc = (string)$_GET['desc'];
$photo = (string)$_GET['photo'];
$rtng = (float)$_GET['rtng'];
$rtngCnt = (float)$_GET['rtngCnt'];
$views = (float)$_GET['views'];
$favs = (float)$_GET['favs'];
$place = (string)$_GET['place'];
$state = (string)$_GET['state'];
$zip = (float)$_GET['zip'];
$weather = (float)$_GET['weather'];
$location = (float)$_GET['location'];
$slope = (float)$_GET['slope'];

// get the id from data.xml
$id = count(file('data.xml')) + 1;

//create an XML node
$marker = <<<XML
<walk id="$id" uid="$uid" title="$title" walkDesc="$walkDesc" pntCnt="$pntCnt" center="$center" pnts="$pnts" desc="$desc" photo="$photo" rtng="$rtng" rtngCnt="$rtngCnt" views="$views" favs="$favs" place="$place" state="$state" zip="$zip" weather="$weather" location="$location" slope="$slope"/>

XML;

// open the data.xml file for appending
$f=@fopen('data.xml', 'a+');
if(!$f) die('-1');

//add the node
$w=@fwrite($f, $marker);
if(!$w) die('0');
@fclose($f);

//return a response
echo <<<XML
$id
XML;
?>
